package commands;

import utils.CommandStack;
import utils.EditorContext;
import workspaces.WorkSpace;
import workspaces.WorkSpaceCenter;

import java.util.Map;

public class SpacesCommand extends Command{
    public SpacesCommand(EditorContext context) {
        super(context);
    }

    @Override
    public void execute() {
        Map<String, WorkSpace> workSpaceMap = WorkSpaceCenter.getInstance().getWorkSpaceMap();
        for(String fileName : workSpaceMap.keySet()) {
            WorkSpace workSpace = workSpaceMap.get(fileName);
            String fileNameWithSaved = workSpace.getContext().getSavingState() == EditorContext.SavingState.ToSave ? fileName + "*" : fileName;
            System.out.println(fileNameWithSaved);
        }
    }
}
